// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'

const api = {
  /**
     * 获取货权转移数据
     * @param {Object} params 检索条件的obj
     */
  reqGetCargoTransfer(params) {
    return Service.get(
      `/${ServiceName}/api/external/cargoTransfer/queryall`,
      { params }
    )
  },

  /**
     * 根据id获取货转记录数据
     */
  reqGetCargoTransferRecord(id) {
    return Service.get(
      `/${ServiceName}/api/external/busCargoInfo/queryTransferInfoById?id=${id}`
    )
  },

  /**
     * 获取货转记录数据
     */
  reqGetCargoTransferDetail(id) {
    return Service.get(
      `/${ServiceName}/api/external/cargoTransfer/queryCargoTransferItemByTransferId?transferId=${id}`
    )
  },
  /**
   * 删除数据
   * @param {*} id 数据id
   */
  reqDeleteCargoTransferDetail(id) {
    return Service.delete(
      `/${ServiceName}/api/external/cargoTransfer/deletebyid?id=${id}`
    )
  },
  /**
     * 货权转移根据票货查询垛位号信息
     * @params {cargoInfoId}
     */
  reqGetStackingPosition(params) {
    return Service.get(
      `/${ServiceName}/api/external/cargoTransfer/queryInOutSumByCargoInfoId`, { params }
    )
  },
  /**
     * 货权转移根据票货查询场地信息
     * @params {cargoInfoId}
     */
  reqGetGround(params) {
    return Service.get(
      `/${ServiceName}/api/external/cargoTransfer/queryStorehouseByCargoInfoId`, { params }
    )
  },
  /**
     * 货权转移根据票货,场地查询垛号信息
     * @params {cargoInfoId,storehouseId}
     */
  reqGetStackingNumber(params) {
    return Service.get(
      `/${ServiceName}/api/external/cargoTransfer/queryStackPositionByCargoInfoId`, { params }
    )
  },
  /**
     * 货权转移根据票货，场地，垛号查询件号信息
     * @params {cargoInfoId,storehouseId,stackPosition}
     */
  reqGetQuantityNumber(params) {
    return Service.get(
      `/${ServiceName}/api/external/cargoTransfer/queryPieceNoByCargoInfoId`, { params }
    )
  },
  /**
     * 货权明细保存
     * @param {Object} params 保存表格的data
     */
  reqSaveCargo(params) {
    return Service.post(
      `/${ServiceName}/api/external/cargoTransfer/insert`,
      params
    )
  }
}
export default api
